package com.auto.autoapp.network.interceptor

import android.util.Log
import okhttp3.logging.HttpLoggingInterceptor

/**
 * 日志拦截器工厂类
 * 用于创建和配置日志拦截器
 */
object LoggingInterceptor {
    
    private const val TAG = "HTTP"
    
    /**
     * 创建日志拦截器
     * @param isDebug 是否为调试模式
     * @return HttpLoggingInterceptor
     */
    fun create(isDebug: Boolean = true): HttpLoggingInterceptor {
        val loggingInterceptor = HttpLoggingInterceptor { message ->
            Log.d(TAG, message)
        }
        
        // 根据是否为调试模式设置不同的日志级别
        loggingInterceptor.level = if (isDebug) {
            HttpLoggingInterceptor.Level.BODY
        } else {
            HttpLoggingInterceptor.Level.NONE
        }
        
        return loggingInterceptor
    }
}


